import Vue from 'vue'
import App from './App.vue'
import router from '@/router'
// 引入全局组件
import TypeNav from '@/components/TypeNav'
Vue.component(TypeNav.name, TypeNav)

// 引入分页器组件
import Pagination from '@/components/Pagination'
Vue.component(Pagination.name, Pagination)

//封装axios请求并拿数据,在F12的网络中查看
// import { reqCategoryList } from '@/api'
// reqCategoryList()

// vuex
import store from '@/store'

// 引入mockServe.js
import '@/mock/mockServe'

// 引入swiper样式
import 'swiper/css/swiper.min.css'

// 全局组件carousel
import Carousel from '@/components/Carousel'
Vue.component(Carousel.name, Carousel)

Vue.config.productionTip = false

// 引入阿里图标库
import '@/assets/fonts/iconfont.css'

// 按需引入element-ui
import { Button } from 'element-ui';
Vue.component(Button.name, Button);

// 注册组件还有一种写法:挂载在原型上
import { MessageBox } from 'element-ui'
Vue.prototype.$msgbox = MessageBox;
Vue.prototype.$alert = MessageBox.alert;

// 使用图片懒加载插件
import VueLazyLoad from 'vue-lazyload'
import lazy from '@/assets/lazy.jpg'
Vue.use(VueLazyLoad, {
  // 懒加载默认的图片
  loading: lazy
})

// 使用表单校验插件
import '@/plugins/validate'

new Vue({
  render: h => h(App),
  // 使用全局事务总线
  beforeCreate() {
    Vue.prototype.$bus = this
  },
  router,
  store,
}).$mount('#app')
